/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 *
 * Copyright 2010 yura, Version 2.0 (the "License");
 *
 * you may not use this file except in compliance with the License.
 *
 * You may obtain a copy of the License at
 *
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *
 * Unless required by applicable law or agreed to in writing, software
 *
 * distributed under the License is distributed on an "AS IS" BASIS,
 *
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 * See the License for the specific language governing permissions and
 *
 * limitations under the License.
 */

package org.opu.doc2db.document.datadocument;

import org.simpleframework.xml.Attribute;

/**
 *
 * @author yura
 */
public abstract class Paragraph {

    /** id of paragraph */
    @Attribute(name="id", required=false)
    protected String id;

    /**
     * Create paragraph associated with specific id
     *
     * @param id id of paragraph
     */
    public Paragraph(@Attribute(name="id")String id) {
        if (id != null && id.isEmpty()){
            id = null;
        }
        this.id = id;
    }

    /**
     * Create paragraph associated with id = 0
     */
    public Paragraph() {
        this("");
    }

    /**
     * Get the value of id
     *
     * @return the value of id
     */
    public String getId() {
        return id;
    }

    /**
     * Set the value of id
     *
     * @param id new value of id
     */
    public void setId(String id) {
        this.id = id;
    }

    /**
     * Get text of paragraph
     * 
     * @return text of paragraph
     */
    public abstract String getText();

    
    @Override
    public String toString() {
        return getText();
    }
}
